$fade-in-duration: 0.3s; // 0.3 秒的 fadeIn 动画
$fade-out-duration: 0.3s; // 0.3 秒的 fadeOut 动画
$toast-padding: 6px 12px;
$toast-font-size: 12px;
$toast-radius: 16px;
$toast-color: white;
$toast-opacity: 0.8;
$toast-z-index: 1000;

$success-color: #81c784;
/* 绿色 */
$error-color: #f77b72;
/* 红色 */
$info-color: #63b5f7;
/* 蓝色 */

.toast-container {
    max-width: 95%;
    min-width: 75%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, $toast-opacity);
    color: $toast-color;
    padding: $toast-padding;
    border-radius: $toast-radius;
    font-size: $toast-font-size;
    font-weight: 600;
    z-index: $toast-z-index;

    // 动态使用 fade-out-delay
    animation: fadeIn $fade-in-duration ease-out, fadeOut $fade-out-duration ease-in var(--fade-out-delay) forwards;

    &.top {
        top: 8%;
    }

    &.bottom {
        bottom: 8%;
    }

    &.center {
        top: 50%;
        transform: translate(-50%, -50%);
    }

    &.success {
        background-color: $success-color;
    }

    &.error {
        background-color: $error-color;
    }

    &.info {
        background-color: $info-color;
    }

    .toast-icon {
        font-size: 24px;
        margin-right: 10px;
    }

    .toast-content {
        display: flex;
        flex-direction: column;

        .toast-title {
            font-weight: bold;
            margin-bottom: 5px;
        }

        .toast-text {
            font-size: 14px;
        }
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}